home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-21 | 1.3 KB | 49 lines | [TEXT/KAHL] |
- // C translation by Adam Wight
-
- #include "SAT.h"
-
- FacePtr GetFaceFromPICT (int colorPICTid,int bwPICTid,int maskPICTid);
-
- /*No error checking yet!*/
-
- FacePtr GetFaceFromPICT (int colorPICTid,int bwPICTid,int maskPICTid) {
- Rect bounds;
- PicHandle thePICT, maskPICT;
- FacePtr theFace;
- GrafPtr savePort;
- GDHandle saveGD;
-
- GetPort(savePort);
- if (gSAT.colorFlag) saveGD = GetGDevice();
-
- /*Get PICTs*/
- if (gSAT.initDepth > 1) thePICT = GetPicture(colorPICTid);
- else thePICT = GetPicture(bwPICTid);
-
- maskPICT = GetPicture(maskPICTid);
- bounds = (*thePICT)->picFrame;
- OffsetRect(&bounds, -bounds.left, -bounds.top); /* Unnecessary? I think NewFace does this for us. /Ingemar */
-
- /*Create face*/
- theFace = SATNewFace(&bounds);
-
- /*Draw in the face*/
- SATSetPortFace(theFace);
- DrawPicture(thePICT, &bounds);
- SATSetPortMask(theFace);
- DrawPicture(maskPICT, &bounds);
- /*Tell SAT that we are done*/
- SATChangedFace(theFace);
-
- /*Get rid of the PICTs*/
- ReleaseResource((Handle)thePICT);
- ReleaseResource((Handle)maskPICT);
-
- /*Return the face.*/
-
- if (gSAT.colorFlag) SetGDevice(saveGD);
- SetPort(savePort);
-
- return theFace;
- }
-